parameters:
  alwaysRun: false
  extraBuildArgs: ''
  extraHelixArgs: ''
  isExtraPlatformsBuild: false
  isWasmOnlyBuild: false
  buildAOTOnHelix: true
  nameSuffix: ''
  platforms: []
  runAOT: false
  shouldRunSmokeOnly: false
  shouldContinueOnError: false

jobs:

#
# Build for Browser/wasm, with EnableAggressiveTrimming=true
#
# non-windows - run only with v8
- ${{ each platform in parameters.platforms }}:
  - template: /eng/pipelines/common/templates/wasm-library-tests.yml
    parameters:
      platforms:
        - ${{ platform }}
      nameSuffix: ${{ parameters.nameSuffix }}
      isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
      isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
      extraBuildArgs: /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=${{ parameters.buildAOTOnHelix }} /p:RunAOTCompilation=${{ parameters.runAOT }} ${{ parameters.extraBuildArgs }}
      extraHelixArgs: /p:NeedsToBuildWasmAppsOnHelix=true ${{ parameters.extraHelixArgs }}
      alwaysRun: ${{ parameters.alwaysRun }}
      shouldRunSmokeOnly: ${{ parameters.shouldRunSmokeOnly }}
      shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
      scenarios:
        - ${{ if eq(platform, 'browser_wasm_win') }}:
          - WasmTestOnBrowser
        - ${{ if ne(platform, 'browser_wasm_win') }}:
          - normal
